﻿using System;
using System.Linq;
using System.Windows.Controls;
using ButsaScraperLib;

namespace ForecastManager.Controls
{
	/// <summary>
	/// Interaction logic for TeamBrick.xaml
	/// </summary>
	public partial class TeamBrick : UserControl
	{
		private Team _team;

		public TeamBrick(Team team)
		{
			InitializeComponent();

			_team = team;

			TeamNameTextBlock.Text = String.Format("{0} ({1}) - {2}", _team.TeamName, _team.TeamId, _team.DivisionName);

			ForceTextBlock.Text = _team.Force.ToString("0.0#");
			Top11ForceTextBlock.Text = _team.Top11Force.ToString("0.0#");
			RatingTextBlock.Text = _team.Rating.ToString("0.00#");
			ManagerTextBlock.Text = _team.HasManager ? _team.Manager : "-";
			PlayersCountTextBlock.Text = _team.Players.Count.ToString();
			PlayersOutOfGameTextBlock.Text = _team.Players
				.Count(player => player.IsDiscvalificated || player.IsTraumed).ToString();
		}
	}
}
